<!DOCTYPE html>
<!--
 File: configure.html
 Author: Henry Feild
 Date: 04-Apr-2013
 Purpose: Exposes settings for the Search Task Assistant to users.

 Copyright (c) 2010-2013
 University of Massachusetts
 All Rights Reserved
-->
<html>
<head>
<title>STA&mdash;Settings</title>

    <link type="text/css" rel="stylesheet" href="jquery.jscrollpane.css"/>
    <!-- <link type="text/css" rel="stylesheet" href="search-task-assistant.css"/> -->
    <link type="text/css" rel="stylesheet" href="page.css"/>

    <script language="javascript" src="jquery-1.7.1.min.js"></script> 

    <script src="init.js"></script>

    <script>
    /**
     * Called after the window has connected with the STA background script.
     * The sta variable will be available when start is called.
     */
    var start = function(){

    //     jQuery('#save-data').click(function(){
    //         demoBackend.saveData([{
    //                 timestamp: new Date().getTime(),
    //                 userInput: jQuery('#data').val()
    //             }], 
    //             function(){displayAndFade(jQuery('#save-success'))},
    //             function(){displayAndFade(jQuery('#save-error'))} 
    //         );
    //     });

    //     jQuery('#read-data').click(function(){
    //         var jqElm = jQuery('#user-input');
    //         jqElm.html('');

    //         demoBackend.readData({
    //             on_chunk: function(data, next, abort){
    //                 var i;
    //                 for(i = 0; i < data.length; i++){
    //                     var newElm = jQuery('<div>').prependTo(jqElm);
    //                     newElm.text(JSON.stringify(data[i]));
    //                 }
    //                 next();
    //             },
    //             on_success: function(){displayAndFade(jQuery('#read-success'))},
    //             on_error: function(){displayAndFade(jQuery('#read-error'))}
    //         });
    //     });


    //     jQuery('#set-preference').click(function(){
    //         var jqNameBox = jQuery('#pref-name');
    //         var jqValueBox = jQuery('#pref-value');
    //         //jqValueBox.val('');

    //         demoBackend.clrmAPI.storage.preferences.set({
    //             pref: jqNameBox.val(),
    //             value: jqValueBox.val(),
    //             on_success: function(){
    //                 displayAndFade(jQuery('#preference-success'));
    //             },
    //             on_error: function(){
    //                 displayAndFade(jQuery('#preference-error'));
    //             }
    //         });
    //     });

    //     jQuery('#get-preference').click(function(){
    //         var jqNameBox = jQuery('#pref-name');
    //         var jqValueBox = jQuery('#pref-value');
    //         var jqDefaultValueBox = jQuery('#pref-default');
    //         jqValueBox.val('...');

    //         demoBackend.clrmAPI.storage.preferences.get({
    //             pref: jqNameBox.val(),
    //             value: jqValueBox.val(),
    //             defaultValue: jqDefaultValueBox.val(),
    //             on_success: function(value){
    //                 displayAndFade(jQuery('#preference-success'));
    //                 jqValueBox.val(value);
    //             },
    //             on_error: function(e){
    //                 displayAndFade(jQuery('#preference-error'));
    //                 jqValueBox.val(e);
    //             }
    //         });
    //     });
    // };

    // var displayAndFade = function(jqElm){
    //     jqElm.show().fadeOut(2000);
    // };


    };
    </script>
</head>
<body>
<div id="content">
    <h1>Search Task Assistant Settings</h1>

    <p>
        Currently, there are no options to configure. We will be adding 
        settings such as: blacklisting page visit/search string patterns,
        how much search history to keep in memory, and an option to parse
        your %%PROJECT_NAME%% search history prior to installing the Search
        Task Assistant app.
    </p>

    <button onclick="window.close()">Close</button>
</div>
</body>
</html>